hysop.backend.device.opencl.opencl_env module

class hysop.backend.device.opencl.opencl_env.OpenClEnvironment(mpi_params, platform_id=None, device_id=None, device_type=None, gl_sharing=False, strict=True, name=None, **kwds)[source]

Bases: TaggedObject

OpenCL environment.

Initialize an OpenCL environment

Parameters:
  • platform_id (int) – chosen platform id.

  • device_id (int) – chosen device id.

  • device_type (string) – chosen device type.

  • gl_sharing (bool, optional) – True to build a context shared between OpenGL and OpenCL. Default=False.

  • mpi_params (mpi parameters, optional) – Communicator which handles the OpenCL env.

  • strict (bool, optional) – Use strict device and platform checks. Try to match exactly given platform and device IDs. Also try to match given device type. Else raise an error. If this is set to False, try to fallback to a working compute device (possibly on a different platform and of a different device type).

  • name (str, optional) – Name used for memory pool logging. Defaults to device name.

  • kwds (dict) – Extra arguments for memory pool creation.

Notes

See hysop.backend.device.opencl.opencl_tools.get_or_create_opencl_env() to create an OpenClEnvironment that will persist and thus maximize memory pool memory reuse on target device.

property allocator
build_raw_src(src, build_options=[], kernel_name=None, force_verbose=None, force_debug=None)[source]

Build raw OpenCL sources

Parameters:
  • src (string) – OpenCL source code

  • build_options (string) – Compiler options to use for building

  • binaries (Returns OpenCL)

build_src(files, build_options='', vector_width=4, nb_remesh_components=1)[source]

Build OpenCL sources

Parameters:
  • files (string or list of strings) – user defined file names

  • build_options (string, optional) – Compiler options, default=””

  • vector_width (int, optional) – OpenCL vector type width, default=4

  • nb_remesh_components (int, optional) – number of remeshed components, default=1

  • force_verbose (bool, optional) – force verbose mode

  • force_debug (bool, optional) – force debug mode (kernel dumping)

  • binaries (Returns OpenCL)

  • precision. (Parse the sources to handle single and double)

build_typegen(precision, float_dump_mode, use_short_circuit_ops, unroll_loops)[source]
property cl_version
property context
create_queue(name)[source]

Create OpenCL queue from current context

property default_queue
property device
device_identifier()[source]
disable_default_queue()[source]
enable_default_queue()[source]
extensions()[source]
get_allocator()[source]
get_cl_version()[source]
get_context()[source]
get_default_queue()[source]
get_device()[source]
get_mpi_params()[source]
get_platform()[source]
get_queues()[source]
has_extension(extension)[source]
property mpi_params
pci_bus_id()[source]

Return the PCI bus id of this device if possible. Format is ‘0000:bus:device.function’ 8+5+3 = 16 bits Example: 0000:01:00.0

property platform
queue(name)[source]
property queues